import Vue from 'vue';
import Router from 'vue-router';
import Layout from '@/views/layout/Layout';


import { home,safetyChart, keyUnit,taskAndMessage,workstationScore, foodSafety, enterprise, interpretation, coldLink ,workstation,performance,distribution} from '@/router/modules/index';

Vue.use(Router);
// 静态路由
export const constantRouterMap = [

  // 主页
  ...home,
  // 任务和消息
  ...taskAndMessage,
  // 食安服务类
  ...foodSafety,
  ...enterprise,
  ...interpretation,
  //冷链
  ...coldLink,
  ...workstation,
  ...workstationScore,
  ...performance,
...keyUnit,
...safetyChart,
...distribution,
  {
    path: '/404',
    component: () => import('@/views/errorPage/404'),
    hidden: true,
  },
  {
    path: '/401',
    component: () => import('@/views/errorPage/401'),
    hidden: true,
  },

  // settings
  {
    path: '/settings',
    component: () => import('@/views/settings'),
    hidden: true,
    noCache: true,
    name: 'settings',
  },
  {
    path: '/settings/setUp',
    component: () => import('@/views/settings/setUp'),
    hidden: true,
    noCache: true,
    name: 'setUp',
  },
  {
    path: '/settings/task',
    component: () => import('@/views/settings/task'),
    hidden: true,
    noCache: true,
    name: 'task',
  },
  // taskPlan
  {
    path: '/taskPlan/taskList',
    component: () => import('@/views/taskPlan/taskList'),
    hidden: true,
    noCache: true,
    name: 'taskList',
  },

  {
    path: '/taskPlan/addTask',
    component: () => import('@/views/taskPlan/addTask'),
    hidden: true,
    noCache: true,
    name: 'addTask',
  },
  // integrityStore
  {
    path: '/integrityStore/storeList',
    component: () => import('@/views/integrityStore/storeList'),
    hidden: true,
    noCache: true,
    name: 'storeList',
  },
  {
    path: '/integrityStore/examine',
    component: () => import('@/views/integrityStore/examine'),
    hidden: true,
    noCache: true,
    name: 'examine',
  },
  {
    path: '/homePage',
    component: () => import('@/views/homePage/homePage'),
    hidden: true,
    noCache: true,
    name: 'homePage',
    children: [
      {
        path: "/copy",
        component: () => import("@/views/home/monitor/monitor"),
        name: "monitor1",
      },
      {
        path: "/toDoUnit1",
        component: () => import("@/views/performance/toDoUnit"),
        name: "toDoUnit1",
      },
      {
        path: "/riskList1",
        component: () => import("@/views/performance/riskList"),
        name: "riskList1",
      },
      {
        path: "/directorEnterprise1",
        component: () => import("@/views/performance/home"),
        name: "directorEnterprise1",
      },
      {
        path: "/statisticalAnalysisAtSupervise1",
        component: () => import("@/views/performance/statisticalAnalysisAtSupervise"),
        name: "statisticalAnalysisAtSupervise1",
      },
      {
        path: "/platform1",
        component: () => import("@/views/performance/platformHome"),
        name: "platform1",
      },
      {
        path: "/keyUnit1",
        component: () => import("@/views/keyUnit/keyUnit"),
        name: "keyUnit1",
      },
      {
        path: "/query1",
        component: () => import("@/views/home/query/query"),
        name: "query1",
      },
      {
        path: "/foodSafety/archives/archives1",
        component: () => import("@/views/foodSafety/archives/archives"),
        name: "archives1",
      },
      {
        path: "/map1",
        component: () => import("@/views/home/map/map"),
        name: "maps1",
      },
      {
        path: "/chainIndex1",
        component: () => import("@/views/chain/index/index"),
        name: "chainIndex1",
      },
      {
        path: "/statisticsInfo1",
        component: () => import("@/views/coldLink/analysis/analysis.vue"),
        name: "statisticsInfo1",
      },

      {
        path: "/foodSafety/notice/notice1",
        component: () => import("@/views/foodSafety/notice/notice"),
        name: "notice1",
      },

      {
        path: "/foodSafety/classroom1",
        component: () => import("@/views/foodSafety/classroom/index"),
        name: "classroom1",
      },
      {
        path: "/foodSafety/regulations/regulations1",
        component: () => import("@/views/foodSafety/regulations/regulations"),
        name: "regulations1",
      },
      {
        path: "/foodSafety/policy/policy1",
        component: () => import("@/views/foodSafety/policy/policy"),
        name: "policy1",
      },
      {
        path: "/foodSafety/messageRemindRecord1",
        component: () => import("@/views/foodSafety/messageRemindRecord/index.vue"),
        name: "messageRemindRecord1",
      },
    ]
  },
  
  // message

  {
    path: '/test',
    component: () => import('@/views/test/test'),
    hidden: true,
    noCache: true,
    name: 'test',
  },
  {
    path: '/warning',
    component: () => import('@/views/enterprise/home/warning'),
    hidden: true,
    noCache: true,
    name: 'warning',
  },
  
  {
    path: "/examine",
    component: () =>
      import("@/views/performance/examine"),
    name: "examine1",
    meta: {
      title: "企业考核",
      isTag: true,
      icon: "iconfont icon-liebiao",
    },
  },
  { path: '*', redirect: '/404', hidden: true },
  //新添加页面 一定要去permission.js 添加白名单
];
// 动态路由
export const asyncRouterMap = [


];
export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap,
});
